import request from '@/utils/request'

// 查询设备通道列表
export function listDeviceChannels() {
  return request({
    url: '/project/temperature/deviceChannels',
    method: 'get'
  })
}

// 获取活跃报警事件数量
export function getOverview() {
  return request({
    url: '/project/temperature/overview',
    method: 'get'
  })
}

// 查询实时温度数据
export function getRealtimeTemperatureData(deviceNo, channelNo) {
  return request({
    url: '/project/temperature/realtimeData',
    method: 'get',
    params: {
      deviceNo,
      channelNo
    }
  })
}

// 查询米标范围温度数据
export function getMeterRangeTemperatureData(deviceNo, channelNo, startMeter, endMeter, startTime, endTime, timeType) {
  return request({
    url: '/project/temperature/trendData',
    method: 'get',
    params: {
      deviceNo,
      channelNo,
      startTime,
      endTime,
      timeType: timeType || 'hour',
      startMeter,
      endMeter
    }
  })
}

export function getDevicesAndChannels() {
  return request({
    url: '/project/temperature/devicesAndChannels',
    method: 'get'
  })
}

// 获取活跃报警事件数量
export function getActiveAlarmCount() {
  return request({
    url: '/project/event/list',
    method: 'get',
    params: {
      eventStatus: 0, // 活跃中的事件
      alarmType: 3, // 温度告警
      pageSize: 1,    // 只需要总数
      pageNum: 1
    }
  })
}


